package com.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.rsocket.annotation.ConnectMapping;
import org.springframework.stereotype.Controller;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Sinks;
@Slf4j
@Controller
public class EchoController {

    Sinks.Many<String> metadataPushPayloads = Sinks.many().replay().all();

    @MessageMapping("echo")
    public String echo(String payload) {
        return payload;
    }

    @ConnectMapping("foo-updates")
    public void handleMetadata(@Header("foo") String foo) {
        log.info("receive: {}",foo);
    }

}
